Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encapsulate item::contents #38026

Merged
merged 1 commit into from
Apr 7, 2020
Merged

Conversation

KorGgenT
Copy link
Member

@KorGgenT KorGgenT commented Feb 14, 2020

Summary

SUMMARY: Infrastructure "encapsulate item::contents into a new class"

Purpose of change

encapsulation will help enormously with continuing to extend item::contents for the nested container system. it'll also restrict accessing contents directly all over the place, like it is now.

Describe the solution

creates a new class called item_contents that has the item contents. adds functions to interact with them. You might notice that a few functions have ret_val returns with not really much going on there, but that is because i'm going to be expanding them basically immediately after, so i saw no reason to redo the function call sites twice. i also had to remove item::emplace_back() and alter a bunch of places that should have item::put_in or something similar. additionally, i have item_contents::front() and item_contents::back() to aid further work, with intent to remove these functions.

Relies on #38022 and has the commits from that pr

Testing

Compiled successfully. additional testing TBD; i altered some tests so they'll show up on travis, and i'll run the game to make sure save/load works properly.

@KorGgenT KorGgenT added [C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style labels Feb 14, 2020
@KorGgenT KorGgenT requested a review from codemime February 14, 2020 23:38
src/item_contents.h Outdated Show resolved Hide resolved
@KorGgenT
Copy link
Member Author

KorGgenT commented Feb 16, 2020

something in visitable is causing a stack overflow.
edit: fixed

src/visitable.cpp Outdated Show resolved Hide resolved
@kevingranade kevingranade merged commit e03227a into CleverRaven:master Apr 7, 2020
@anothersimulacrum anothersimulacrum mentioned this pull request Apr 9, 2020
@KorGgenT KorGgenT deleted the item-contents branch August 13, 2020 04:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code` Code: Infrastructure / Style / Static Analysis Code internal infrastructure and style
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants